<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<link rel="stylesheet" href="">
	<style type="text/css" media="screen">
	body {
		background: #000;
	}
		canvas {
			background: #fff;
		}
	</style>
</head>
<body>
	<script>
		window.onload = function() {
			var can = document.getElementById('can')
			var can1 = can.getContext('2d')
			can.onmousedown = function(ev) {
				var ev = ev || window.event;
				can1.moveTo(ev.clientX - can.offsetLeft, ev.clientY - can.offsetTop);
				document.onmousemove = function(ev) {
					var ev = ev || window.event;
					can1.lineTo(ev.clientX - can.offsetLeft, ev.clientY - can.offsetTop);
					can1.strock();
				}
			}
			document.onmouseup = function(ev) {
				document.onmousedown = null
				document.onmouseup = null
			}
		}
	</script>
	<canvas id="can" width="400" height="400">
		
	</canvas>
</body>
</html>